// pages/titleLlist/titleLlist.js
const app = getApp();
import Util from "../../utils/util"
import api from '../../utils/api'
Page({
  /**
   * 页面的初始数据
   */
  data: {
     notgets_first:[],
     notgets_end:[],
     gets:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options)  {
     this.loadLevels();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },
  loadLevels:function(){
    //加载排行数据
    var _this = this;
    var token = wx.getStorageSync('token');
    var url = 'index.php?g=User&m=Consumer&a=getUserLevel';
    var type = app.setConfig.type;
    api.post(url, { type:type, token: token }, function (res) {
          console.log(res);
          if(res.code==2000)
          {
              _this.setData({
                 gets:res.data.gets,
                 notgets_first:res.data.notgets.first,
                 notgets_end:res.data.notgets.end
              });
          }else{
            wx.showLoading({
              title: "加载数据失败", 
              duration: 1000
            })
          }
    });
  }
})